package j2seperf.seri;

import java.io.*;
import java.util.Date;
import java.util.Vector;

public class SaveTest {

	private static Vector vector = new Vector();
	private static Vector vectorTrans = new Vector();
	private static int NUM_OBJECTS = 50;

	public static void main(String args[]) {

		for (int i = 0; i < NUM_OBJECTS; i++) {
			vector.addElement(new TestObjectTrans(i));
		}

		// for (int i = 0; i < NUM_OBJECTS; i++) {
		// vector.addElement(new TestObject(i));
		// }

		Stopwatch timer = new Stopwatch().start();
		try {
			OutputStream file = new FileOutputStream("Out.test");
			OutputStream buffer = new BufferedOutputStream(file);
			ObjectOutputStream out = new ObjectOutputStream(buffer);
			out.writeObject(vector);
			out.close();
		} catch (Exception e) {
			e.printStackTrace();
		}

		timer.stop();
		System.out.println("elapsed = " + timer.getElapsedTime());
		long mem = Runtime.getRuntime().totalMemory()
				- Runtime.getRuntime().freeMemory();
		System.out.println("Mem Consumed = " + mem / 1000 + " kb");
		System.exit(0);
	}
}